import time

from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "dbshopST010_处理退货"

#提取编号
rootPath=get_pro_rootpath()
filePath=rootPath+r'\public\order002.text'
orderID=readFile(filePath)
print(orderID)
# 打开后台网址
firefox = openBrowser(urlAdmin)
# 登陆
DBshopLoginAdmin(firefox)
# 进入二级菜单
DBshopEnterMenu2(firefox, '销售管理', '退货管理')
firefox.find_element_by_name('order_sn').send_keys(orderID)
firefox.find_element_by_xpath('(//select[@name="refund_type"])/option[2]').click()
firefox.find_element_by_xpath('//button[contains(text(),"搜索")]').click()
firefox.find_element_by_link_text('处理退货').click()
firefox.find_element_by_xpath('//button').click()
firefox.find_element_by_link_text('查看详情').click()
#断言
try:
    firefox.find_element_by_xpath('//span[text()="退款成功"]')
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()

